home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
c_news
/
16
/
sets
/
setsourc
/
setprint.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-03-23
|
1KB
|
51 lines
#include <stdio.h>
#include <stdarg.h>
#include "sets.h"
/*************************************************************************
REV. 3-19-89: Added c<aset->set_size as upper limit in set_print.
This allows set_size smaller than 256.
**************************************************************************
*************************************************************************/
void set_print(set *aset)
/*************************************************************************/
/* Prints current members of the set. */
{
char c;
int i;
boolean b;
printf("[");
switch(aset->base_type) {
case BOOLEAN:
for(b=FALSE; b<=TRUE; b++)
if(in_set(aset,b) == TRUE) {
if(b == TRUE)
printf("TRUE ");
else
printf("FALSE ");
}
break;
case CHARACTER: /* prints all but \0xff */
/* REV. 3-19-89: added c<aset->set_size as upper limit. */
/* This allows set_size smaller than 256. */
for(c='\x00';(c<'\xff')&&(c<aset->set_size);c++) {
if(in_set(aset,(c & 0xff)) == TRUE)
printf("%c",c);
}
break;
case UNIVERSAL:
case ENUMERATED:
case SUBRANGE:
for(i=0; i<aset->set_size; i++)
if(in_set(aset,i) == TRUE)
printf("%d ",i);
}
printf("]");
} /* end set_print */